home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tpl60n19.zip / TESTPRGS.ZIP / DHRYSTON.PAS < prev    next >
Pascal/Delphi Source File  |  1993-02-14  |  31KB  |  843 lines

  1. {$A+,B-,D+,E+,F-,G-,I-,L+,N-,O-,R-,S-,V-,X-}
  2. {$M 16384,0,655360}
  3. (*
  4.  ****************************************************************************
  5.  *
  6.  *                   "DHRYSTONE" Benchmark Program
  7.  *                   -----------------------------
  8.  *
  9.  *  Version:    Pascal, Version 2.1
  10.  *
  11.  *  File:       dhry.p
  12.  *
  13.  *  Date:       May 25, 1988
  14.  *
  15.  *  Author:     Reinhold P. Weicker
  16.  *                      Siemens AG, E STE 35
  17.  *                      Postfach 3220
  18.  *                      8520 Erlangen
  19.  *                      Germany (West)
  20.  *                              Phone:  [xxx-49]-9131-7-20330
  21.  *                                      (8-17 Central European Time)
  22.  *                              Usenet: ..!mcvax!unido!estevax!weicker
  23.  *
  24.  *              Original Version (in Ada) published in
  25.  *              "Communications of the ACM" vol. 27., no. 10 (Oct. 1984),
  26.  *              pp. 1013 - 1030, together with the statistics
  27.  *              on which the distribution of statements etc. is based,
  28.  *
  29.  *              This version uses calls to the Pascal runtime library of the
  30.  *              Berkeley UNIX system (4.3 bsd) for time measurement.
  31.  *              For measurements on other systems, these calls need to be
  32.  *              modified.
  33.  *
  34.  *  Collection of Results:
  35.  *              Reinhold Weicker (address see above) and
  36.  *
  37.  *              Rick Richardson
  38.  *              PC Research. Inc.
  39.  *              94 Apple Orchard Drive
  40.  *              Tinton Falls, NJ 07724
  41.  *                      Phone:  (201) 834-1378 (9-17 EST)
  42.  *                      Usenet: ...!seismo!uunet!pcrat!rick
  43.  *
  44.  *      Please send results to Rick Richardson and/or Reinhold Weicker.
  45.  *      Complete information should be given on hardware and software used.
  46.  *      Hardware information includes: Machine type, CPU, type and size
  47.  *      of caches; for microprocessors: clock frequency, memory speed
  48.  *      (number of wait states).
  49.  *      Software information includes: Compiler (and runtime library)
  50.  *      manufacturer and version, compilation switches, OS version.
  51.  *      The Operating System version may give an indication about the
  52.  *      compiler; Dhrystone itself performs no OS calls in the measurement loop.
  53.  *
  54.  *      The complete output generated by the program should be mailed
  55.  *      such that at least some checks for correctness can be made.
  56.  *
  57.  ****************************************************************************
  58.  *
  59.  *  History:    This version Pascal/2.1 has been made for two reasons:
  60.  *
  61.  *              1) There is a need for a common Pascal version of
  62.  *              Dhrystone. Although translation from the published (Ada)
  63.  *              version to Pascal is straightforward in most aspects,
  64.  *              there are cases where it may not be obvious to everyone.
  65.  *              There should be, as far as possible, only one Pascal version
  66.  *              of Dhrystone such that results can be compared without
  67.  *              restrictions. Also, a Pascal version of Dhrystone has not yet
  68.  *              found a network distribution comparable to the C version
  69.  *              (version 1.1) distributed by Rick Richardson.
  70.  *
  71.  *              2) As far as it is possible without changes to the Dhrystone
  72.  *              statistics, optimizing compilers should be prevented from
  73.  *              removing significant statements.
  74.  *
  75.  *              This Pascal version 2.1 has been made consistent with the
  76.  *              C version 2.1; therefore the acknowledgments for the C version
  77.  *              are due for the Pascal version as well: I thank
  78.  *              Rick Richardson (Tinton Falls, NJ), Chaim Benedelac (Nat.
  79.  *              Semi.), David Ditzel (SUN), Earl Killian and John Mashey (MIPS),
  80.  *              Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley)
  81.  *              for their help with comments on earlier versions of the
  82.  *              benchmark.
  83.  *
  84.  *  Changes:    In the initialization part, this version differs
  85.  *              from the Pascal version previously distributed by Reinhold
  86.  *              Weicker, the number of runs through Dhrystone is obtained
  87.  *              interactively from the terminal. Output of the result
  88.  *              has been changed to conform to the C version (2.1).
  89.  *              The changes in the initialization part and in the printing
  90.  *              of the result have no impact on performance measurement
  91.  *              since they are outside the measaurement loop.
  92.  *
  93.  *              Inside the measurement loop, this version follows the
  94.  *              version previously distributed by Reinhold Weicker.
  95.  *              As a correction to the published version, a statement
  96.  *              initializing Array2Glob [8,7] (outside the measurement
  97.  *              loop) has been added. Otherwise, this array element would
  98.  *              have an undefined value.
  99.  *
  100.  *              At several places in the benchmark, code has been added,
  101.  *              but within the measurement loop only in branches that
  102.  *              are not executed. The intention is that optimizing compilers
  103.  *              should be prevented from moving code out of the measurement
  104.  *              loop, or from removing code altogether. Since the statements
  105.  *              that are executed within the measurement loop have NOT been
  106.  *              changed, all numbers defining the "Dhrystone distribution"
  107.  *              (distribution of statements, operand types and locality)
  108.  *              still hold. Except for sophisticated optimizing compilers,
  109.  *              execution times for this version should be the same as
  110.  *              for previous versions.
  111.  *
  112.  *              Since it has proven difficult to subtract the time for the
  113.  *              measurement loop overhead in a correct way, the loop check
  114.  *              has been made a part of the benchmark. This does have
  115.  *              an impact - though a very minor one - on the distribution
  116.  *              statistics which have been updated for this version.
  117.  *
  118.  *              All changes within the measurement loop are described
  119.  *              and discussed in the companion paper "Rationale for
  120.  *              Dhrystone version 2".
  121.  *
  122.  *              Because of the self-imposed limitation that the order and
  123.  *              distribution of the executed statements should not be
  124.  *              changed, there are still cases where optimizing compilers
  125.  *              may not generate code for some statements. To a certain
  126.  *              degree, this is unavoidable for small synthetic benchmarks.
  127.  *              Users of the benchmark are advised to check code listings
  128.  *              whether code is generated for all statements of Dhrystone.
  129.  *
  130.  *              Version 2.1 is identical to version 2.0 distributed via
  131.  *              the UNIX network Usenet in March 1988 except that it corrects
  132.  *              some minor deficiencies that were found by users of version 2.0.
  133.  *              The only change within the measurement loop is that a
  134.  *              non-executed "else" part was added to the "if" statement in
  135.  *              Func3, and a non-executed "else" part removed from Proc3.
  136.  *
  137.  ***************************************************************************
  138.  *
  139.  *  Compilation model and measurement (IMPORTANT):
  140.  *
  141.  *  This program contains the Dhrystone program, including measurement setup,
  142.  *  in one file. The original (Ada) program contained three packages,
  143.  *  - a package with global type definitions,
  144.  *  - Pack_1, containing the main program (Proc_0 in Ada) and procedures
  145.  *            Proc_1, ... , Proc_5,
  146.  *  - Pack_2, containing Proc_6, ... , Proc_8, Func_1, ..., Func_3.
  147.  *  Since ISO/ANSI Standard Pascal provides no means to express separate
  148.  *  compilation (although many Pascal implementations provide such a feature),
  149.  *  it is not possible to formulate a portable Pascal version with the program
  150.  *  in several modules, corresponding more closely to the Ada and C versions.
  151.  *  Therefore, no attempt has been made t